CalcService 3.1
    ©2001-2003 Christian Grunenberg, DEVONtechnologies

    This service calculates the result of a selected formula within all Cocoa applications
    (e.g. Textedit, Mail, Stickies, Notes, ProjectBuilder, Fire, OmniWeb or TeXShop) and
    Carbon applications supporting services. The result is appended to the formula or replaces
    the formula. In addition there's the possibility to display the result in a panel or to copy the
    result to the clipboard without modifying the text. So there's no more need to start
    Calculator or stuff like that if you only want to calculate some values immediately within
    text windows or dialog fields.

    Licence:
    This software and associated data are provided "as is" without any further
    warranties or support and to be used at your own risk. No responsibility is taken
    for the use or misuse of this software, the data supplied with it and for the correctness
    of any information derived from the use of this software.
    Unmodified redistribution of this software is permitted.

    Installation:
	Copy CalcService into the directory "Services" (located in the Library folder of your 	home directory), then log out and log in again. If there's no such folder, just create
	one using the Finder.

    System requirements:
	• Mac OS X 10.1 (or newer)

    Usage:
	Select a formula (may contain white characters like space, tabulator, new line, carriage
	return), choose Calculate & Append, Calculate & Replace, Calculate & Show or
	Calculate & Copy in the services menu or or press the associated shortcuts if available.
	If the formula is not correct (or the result is undefined) CalcService just beeps or
	displays an error message in the panel.

    Operators/Numbers:
	• floating point values: x.y or x,y
	• add, substract, multiply, divide, modulo, exponential: +-*/%^
	• assign: =
	  Assigned variables are persistent and still available the next time you're going to
	  use CalcService. To define multiple variables in one formula, separate the
	  definitions with a semicolon (";"), as part of a formula use parenthesis around the
	  definition (see examples below)
	• sign: +-
	• parenthesis: ()

    Functions (case-insensitive):
	• exp (base e)
	• exp10 (base 10)
	• exp2 (base 2)
	• ln (base e)
	• log or log10 (base 10)
	• log2 (base 2)
	• sin (RAD)
	• asin (-1...1)
	• cos (RAD)
	• acos (-1...1)
	• tan (RAD)
	• atan
	• sqrt (square-root)
	• abs (absolute)
	• sign
	• fact (factorial for statistics, combinations and variations etc.)
	• ceil
	• floor
	• round
	• sinh
	• asinh
	• cosh
	• acosh
	• tanh
	• atanh

    Constants (case-insensitive):
	• pi (3.1415926535897932385)
	• e (2.7182818284590452354)
	• c (299792458.0 m/s)
	• g (66.732e-12 N*m^2/kg^2)
	• e0 (1.6021892e-19 As)
	• u0 (1.2566e-6 V*s/(A*m)
	• qe (1.602189e-19 C)
	• me (9.109534e-31 kg)
	• mp (1.672614e-27 kg)
	• mn (1.67492e-27 kg)

      If you want to change those values or define new constants, set one ore more
      variables using the assigment-operator (see below).

    Examples:
	5+4-3*(pi+6,3)
	3*+5
	7/--2
	9/.125
	mp*(c*c)
	sqrt(exp(sin(pi/2))+7.5)
	cos(ln(e)*pi)
	exp(1)
	abs(sin(sqrt(2)))*sign(cos(pi*pi))
	9.3%2.5
	2*3^-(1+1)

    Single assigments:

		x=2			=> 2
		y=x+3;			=> 5	
		(x=4)*y		=> 20

    Multiple assignments:

		x = 5; y = 7+3; z = x+y	=> 15
		x = 1; y = 3;			=> 3
		x = 5; y = 3; x*exp(y)		=> 100.428
		(x=y=4)*7 			=> 28
		(x=4;y=5;)*7+x-y		=> 34

    Customization:

	If you want to remove unnecessary services or change the menus or shortcuts, you
	have to edit the file "info.plist" within the CalcServices-package (use contextual menus
	in the Finder to show the contents).

		- Delete elements of the array "NSServices" to remove unnecessary services
		- Change the "default"-element of "NSKeyEquivalent"-dictionaries to adapt
		  shortcuts
		- Change the "default"-element of "NSMenuItem"-dictionaries to adapt the
		  name or structure of menu-items

    Known bugs & limitations:
	• Don't use another CalcService-function while a results panel is still visible
	• Shortcuts are only available after you have at least once opened the services-menu
	  (seems to be a bug in Mac OS X as this is the case for all services)
	• Due to bugs in the service system of Mac OS X up to version 10.2.6, the services
	  menu might disappear in Carbon applications like the Finder if the number of
	  service items exceeds a certain number (around 60-70 items usually). Just remove
	  all unnecessary applications providing services if that's the case.
	• In addition some service commands modifying selected text might not work in
	  Carbon applications like the Finder too (the result just looks like "garbage"). This
	  is either a bug of those applications or Mac OS X.

    History:
	• Version 3.1:
		- ceil(), floor(), round(), acosh(), asinh(), atanh(), cosh(), sinh() and tanh() functions added
		- Shortcut of "Calculate & Copy" removed (Cmd-< and Cmd-> are used to
		  switch the active window on german and probably other systems)
	• Version 3.0:
		- Command "Calculate & Copy" added (sends the result to the clipboard)
		- Exponential operator (^) added
	• Version 2.7.1:
		- Renamed service localizations from "servicesMenu.strings" to "ServicesMenu.strings"
		  (fixes problems under 10.2.x but I've no idea if this works under 10.1.x)
		- Improved dutch localization
		- Localized formatting of output
		- Fixed some number formatting issues (e.g. "5+5.1 = 10.0999999046") and more
		  precise parsing of constant numbers
	• Version 2.7:
		- French localization (received multiple localiazions - thanx for your support!)
		  including "LisezMoi" by Stéphane Moureau (thx1133@freegates.be)
		- Improved formatting of numbers
	• Version 2.6:
		- "Calculate & Append" preserves text attributes
		- German & Dutch localizations
	• Version 2.5.2:
		- The Calculate & show-window appeared in the background under Mac OS X 10.1
		- Recompiled using the Mac OS X 10.1-developer tools with maximal
		  optimization and no debugging symbols (faster and smaller code)
		- Readme explains how to customize the services-menu
		- Service-extension
	• Version 2.5.1:
		- Revised services-menu (like menus of WordService 2.0)
		- CalcService didn't always terminate in the background
	• Version 2.5:
		- New assigment-operator "=" provides the possibility to define
		  as many variables and constants as you like within one single
		  formula (separated by semicolon ";"), across multiple formulas or
		  as part of a formula
		- Factorial-function fact() added (useful for statistics, combinations,
		  variations etc.)
		- Additional predefined physical constants (u0, qe)
		- CalcServices beeps (or displays an error-message in the panel)
		  if a formula is incorrect
	• Version 2.1:
		- Modulo-operator (%) added
		- "Calculate & Add" renamed to "Calculate & Append"
		- Problem with positive signs (e.g. 3*+5) fixed
		- After using "Calculate & Show", CalcService didn't terminate in
		  the background (afterwards using CalcService again was faster,
		  but nobody wants a service to use memory persistently)
		- Memory leak fixed
	• Version 2.0:
		- New "Calculate & Show"-item:
			Displays the result in a panel
		- Popular mathematical functions implemented (trig, log, exp, ...)
		- List of constants is editable
		- Formulas across multiple lines didn't work
		- Some incorrect formulas (e.g "5/") could freeze the current application
	• Version 1.0:
		- Initial release

    Christian Grunenberg
    mailto:christian@grunenberg.net
    http://www.grunenberg.net

    DEVONtechnologies
    http://www.devon-technologies.com